build: false
clone_depth: 2
clone_folder: c:\projects\symfony
image: Visual Studio 2019

init:
    - SET PATH=c:\php;%PATH%
    - SET COMPOSER_NO_INTERACTION=1
    - SET SYMFONY_DEPRECATIONS_HELPER=strict
    - SET ANSICON=121x90 (121x90)
    - SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
    - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f

install:
    - mkdir c:\php && cd c:\php
    - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.2.0-Win32-vs16-x86.zip
    - 7z x php-8.2.0-Win32-vs16-x86.zip -y >nul
    - cd ext
    - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.22-8.2-ts-vs16-x86.zip
    - 7z x php_apcu-5.1.22-8.2-ts-vs16-x86.zip -y >nul
    - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip
    - 7z x php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip -y >nul
    - cd ..
    - copy /Y php.ini-development php.ini-min
    - echo memory_limit=-1 >> php.ini-min
    - echo serialize_precision=-1 >> php.ini-min
    - echo max_execution_time=1200 >> php.ini-min
    - echo post_max_size=2047M >> php.ini-min
    - echo upload_max_filesize=2047M >> php.ini-min
    - echo date.timezone="America/Los_Angeles" >> php.ini-min
    - echo extension_dir=ext >> php.ini-min
    - echo extension=php_xsl.dll >> php.ini-min
    - copy /Y php.ini-min php.ini-max
    - echo zend_extension=php_opcache.dll >> php.ini-max
    - echo opcache.enable_cli=1 >> php.ini-max
    - echo extension=php_openssl.dll >> php.ini-max
    - echo extension=php_apcu.dll >> php.ini-max
    - echo extension=php_igbinary.dll >> php.ini-max
    - echo extension=php_redis.dll >> php.ini-max
    - echo apc.enable_cli=1 >> php.ini-max
    - echo extension=php_intl.dll >> php.ini-max
    - echo extension=php_mbstring.dll >> php.ini-max
    - echo extension=php_fileinfo.dll >> php.ini-max
    - echo extension=php_pdo_sqlite.dll >> php.ini-max
    - echo extension=php_curl.dll >> php.ini-max
    - echo extension=php_sodium.dll >> php.ini-max
    - copy /Y php.ini-max php.ini
    - cd c:\projects\symfony
    - appveyor DownloadFile https://getcomposer.org/download/latest-stable/composer.phar
    - mkdir %APPDATA%\Composer && copy /Y .github\composer-config.json %APPDATA%\Composer\config.json
    - git config --global user.email ""
    - git config --global user.name "Symfony"
    - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep ' VERSION = ' src/Symfony/Component/HttpKernel/Kernel.php | grep -o '[0-9][0-9]*\.[0-9]'"`) DO (SET SYMFONY_VERSION=%%F)
    - php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit
    - SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
    - php composer.phar update --no-progress --ansi
    - php phpunit install
    - choco install memurai-developer

test_script:
    - SET X=0
    - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
    - copy /Y c:\php\php.ini-min c:\php\php.ini
    - IF %APPVEYOR_REPO_BRANCH:~-2% neq .x (rm -Rf src\Symfony\Bridge\PhpUnit)
    - mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
    - php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || SET X=!errorlevel!
    - php phpunit src\Symfony\Component\HttpClient || SET X=!errorlevel!
    - copy /Y c:\php\php.ini-max c:\php\php.ini
    - php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || SET X=!errorlevel!
    - php phpunit src\Symfony\Component\HttpClient || SET X=!errorlevel!
    - exit %X%
